(function(){
	pos = 0;
	ticking = false;
	var header = document.querySelector(".header");
	window.addEventListener("scroll", function(e){
		pos = window.scrollY;
		if(pos > 2 && !ticking){
			header.classList.add("scroll");
			ticking = true;
		}
		if(pos < 2 && ticking){
			header.classList.remove("scroll");
			ticking = false;
		}
	});
})();

$('.header .right').click(function(){
	window.location.href = '../html/search.html';
})

$('.items').click(function(){
	window.location.href = '../html/commodity.html';
})



$.ajax({
    type:'get',
    url:'../json/shouye.json',
    success:function(res){
        var str = template("shouye",{data:res});
        $(".items").append(str);
    }
})
